#region Usings
using System;
using BK.BL;
using Lib.ApplicationBlocks.Modules.Web.General.UserControls;
using Lib.Data.ORM.Entity;
using Lib.Data.ORM.EntityManagement;
#endregion

namespace BK.WebSite.AppCode
{
    public abstract class BkDataListControl<TEntity, TEntityView> : DataListControl<TEntity, TEntityView>
        where TEntityView : BaseDataView<TEntity, IdentifierInt> where TEntity : IEntity, new()
    {
        #region Instance Methods
        protected override TEntityView GetEntityView()
        {
            Type typeOfEntity = typeof (TEntity);

            if (BlContext.Instance.DataManagers.Contains(typeOfEntity))
                return (TEntityView) BlContext.Instance.DataManagers[typeOfEntity];
            
            return (TEntityView) BlContext.Instance.DataViews[typeOfEntity];
        }
        #endregion
    }
}